﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{

    public class PickReplenishUIRule
    {
        private static PickReplenishUIRule _NewInstance = new PickReplenishUIRule();

        public static PickReplenishUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new PickReplenishUIRule();
                }

                return _NewInstance;
            }
        }

        public ResultModel<List<LocationGoodsInfo>> GetPickCellNo()
        {
            try
            {
                ResultModel<List<LocationGoodsInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IPickReplenish>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsInfo>>>("GetPickCellNo", new object[] { });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInfo>>().GetInstance();
                return _result; 
 
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public ResultModel<List<PickReplenishInfo>> GetPickLocationGoods(string batchNo, DateTime rationDate)
        {
            try
            {
                ResultModel<List<PickReplenishInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IPickReplenish>.NewInstance.InvokeWebMethod < ResultModel<List<PickReplenishInfo>>>("GetPickLocationGoods", new object[] { batchNo, rationDate });
                if (_result == null)
                    return new ResultModel<List<PickReplenishInfo>>().GetInstance();
                return _result; 
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<PickReplenishInfo>>().GetInstance();
            }
 
        }



        public ResultModel<bool> UpdateReplenishStatus(string userID, List<PickReplenishInfo> lstPickReplenish)
        {
            try
            {
                ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IPickReplenish>.NewInstance.InvokeWebMethod<List<PickReplenishInfo>, ResultModel<bool>>("UpdateReplenishStatus", new object[] { userID }, lstPickReplenish);
                if (_result == null)
                    return new ResultModel<bool>().GetInstance();
                return _result; 
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<bool>().GetInstance();
            }
        }
    }
}
